package com.spring.nio.core.event.model;

import com.spring.nio.core.channel.context.SocketChannelContext;
import lombok.Data;

import java.net.Socket;
import java.util.List;

/**
 * @author: YSFY
 * @date: 2021-03-26 13:53
 * @pacage_name: com.spring.nio.service.chat.model
 * @class_name: ChatPacketData
 * @description: 聊天服务半包拆包后的数据
 */

@Data
public class PacketData {

    /**
     * 通道上下文
     * */
    private SocketChannelContext socketChannelContext;

    /**
     * 当前通道完整的一帧数据集合
     * */
    private List<FrameData> fullFrameDataList;

    public static PacketData newPacket(SocketChannelContext socketChannelContext, List<FrameData> fullFrameDataList) {
        PacketData packetData = new PacketData();
        packetData.setSocketChannelContext(socketChannelContext);
        packetData.setFullFrameDataList(fullFrameDataList);
        return packetData;
    }
}
